<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>字符串的静态方法</title>
</head>

<body>
  <script>
    // 数组转换为字符串方法:join
    // 字符串转换为数组方法:split
    const str1 = 'pink, red'
    const arr1 = str1.split(',')
    console.log(arr1);

    const str2 = '2024-03-21'
    const arr2 = str2.split('-')
    console.log(arr2);
    console.log('==========字符串截取subString=============');
    const str3 = '自学前端中'
    // 需求,把前端截取出来
    // 截取:含头不含尾
    console.log(str3.substring(2, 4));
  </script>
</body>

</html>